<?php
require_once("taskView.php");
require_once(CORE_DIR.'taskModel.php');

class getusertasksAction extends authAction{

	function __construct(){
		$this->view = new taskView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$tModel = new taskModel();		
		
		if (isset($get["userid"]))
		{
			if ($get["userid"] != "0")
			{
				$projects = $tModel->getUserTasks($get["userid"]);
			}
			else
			{
				$projects = $tModel->getUsersTasks();
			}
			
			$this->view->setProperty("projects", $projects);
			$this->view->showGetUserTasks();
		}
		else 
		{
			$this->view->showBadCmd();
		}
	}
}
?>